<!DOCTYPE html>
<html lang="en">
<?php
require("header.php");
?>
<?php
$name=$_SESSION["账户"];
$sql = "select * from room where 所属商家='{$name}'and 状态='N'";
//echo $sql;
$rs=mysqli_query($db_link,$sql);
if(!$rs)
{
    echo "无满足条件的记录！";
    exit;
}
//$rows=mysqli_fetch_assoc($rs);



//echo $rows["房间号"];
?>
<div class="panel panel-default" style="margin-top: 20px; margin-right: 20px;width: 78%;height:550px;float: right;">
<table class="table table-hover text-center" style="width: 100%;">
<!-- On rows -->
<?php
if(!mysqli_fetch_assoc($rs)){
    echo "<h3>房间都住满了呢！<h3>";
}
	$Z=0;
	$NZ=0;
echo"<th class='text-center'>房间号</th>";
echo"<th class='text-center'>房间类型</th>";
echo"<th class='text-center'>房间等级</th>";
echo"<th class='text-center'>价格</th>";
echo"<th class='text-center'>状态</th>";
echo"<th class='text-center'>是否确认预订</th>";
echo"<th class='text-center'>操作</th>";
   while($rows=mysqli_fetch_assoc($rs)){
   	++$Z;
   	 if($rows["状态"]!=='N'){++$NZ; echo "<tr class='danger' >";}else{
   	 	echo "<tr class='success' >";
   	 }


       $zt=$rows["状态"]=='N'?'未入住':'已入住';
       $qr=$rows["确认"]=='N'?'商家未确认':'商家已确认';
       echo"<td >".$rows["房间号"]."</td>";
       echo"<td >".$rows["类型"]."</td>";
       echo"<td >".$rows["等级"]."</td>";
       echo"<td >".$rows["价格"]."/天</td>";
       echo"<td >".$zt."</td>";
       echo"<td >".$qr."</td>";
  if($rows["状态"]=='N'){
  echo"<td ><a href='add_check.php?id=".$rows['房间号']."'>入住</a>
  
</td>";}else{  echo"<td ><a data-target='#myModal' data-toggle='modal' href='Settlement.php?id=".$rows['房间号']."'>结算</a> </td>";}
   
echo"</tr>";
}
$LV=($NZ/$Z)*100;
?>

</table>

<div class="progress">
  <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="<?php echo round($LV,2); ?>" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo round($LV,2); ?>%">
    当前宾馆客房利用率:<?php echo round($LV,2); ?>% 
  </div>
</div>
</div>



<div class="modal fade bs-example-modal-sm" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog modal-sm" role="document">
    <div class="modal-content">
 
    </div>
  </div>
</div>
</body>
</html>